#! /bin/sh -vx
#
# Copyright 2021 TANAKA Takuji
# You may freely use, modify and/or distribute this file.

BinDir=${BinDir:-.}
ExeExt=${ExeExt:-}
_dvipos=$BinDir/dvipos$ExeExt

# pre-generated test results in the repository are stored in LF
# but the output might be written in CRLF on some platform.
# if 'diff --strip-trailing-cr' is available, exploit it.
# (useful for tests on win32 binaries run on MSYS shell)
DIFF="diff"
$DIFF --strip-trailing-cr $0 $0 \
  && DIFF="diff --strip-trailing-cr" || echo

TEXMFCNF=$srcdir/../kpathsea
TFMFONTS="$srcdir/tests"
export TEXMFCNF TFMFONTS

## play.dvi has no "pos:" specials
rm -rf play*.*
cp $srcdir/tests/play.dvi .
$_dvipos -b -o play.loc play.dvi || exit 1
diff play.loc $srcdir/tests/play.loc || exit 2

grep -v 'Processing_data_and_time' $srcdir/tests/play.pos > play_0.pos \
  && grep -v 'Processing_data_and_time' play.pos > play_1.pos \
  && $DIFF play_0.pos play_1.pos || exit 3

